<template>
  <div>
    <el-container>
      <el-aside width="200px">
        <el-menu
              default-active="1"
              @select="changeRoute"
              class="el-menu-vertical-demo"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b">
              <el-menu-item index="1">
                <i class="el-icon-menu"></i>
                <span slot="title">用户管理</span>
              </el-menu-item>
              <el-menu-item index="2">
                <i class="el-icon-document"></i>
                <span slot="title">订单管理</span>
              </el-menu-item>
              <el-menu-item index="3">
                <i class="el-icon-setting"></i>
                <span slot="title">商品管理</span>
              </el-menu-item>
              <el-menu-item index="4">
                <i class="el-icon-setting"></i>
                <span slot="title">地址管理</span>
              </el-menu-item>
            </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <div class="personal-left fl">绿竹山庄后台管理系统</div>
          <div class="personal-right fr">
           <el-dropdown @command="check">
             <span class="el-dropdown-link">
               欢迎您：{{user.name}}<i class="el-icon-arrow-down el-icon--right"></i>
               </span>
             <el-dropdown-menu slot="dropdown">
               <el-dropdown-item :command="1">个人信息</el-dropdown-item>
               <el-dropdown-item :command="2">退出登录</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
           <el-dialog title="个人信息" width="30%" :visible.sync="dialogFormVisible">
             <el-form class="personform">
               <el-form-item label="用户名">
                 <el-input></el-input>
               </el-form-item>
               <el-form-item label="用户账号">
                 <el-input></el-input>
               </el-form-item>
             </el-form>
             <div slot="footer">
               <el-button @click="dialogFormVisible = false">取 消</el-button>
               <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
             </div>
           </el-dialog>
          </div>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
export default {
  data () {
    return {
      dialogFormVisible: false,
      user: {
        name: '张三',
        account: '13187207536'
      },
      isCollapse: true
    }
  },
  components: {

  },
  computed: {

  },
  methods: {
    changeRoute (index) {
      let map = new Map()
      map.set('1', 'userManager')
      map.set('2', 'orderManager')
      map.set('3', 'shoesManager')
      map.set('4', 'addressManager')
      let routeUrl = map.get(index)
      this.$router.push(routeUrl)
    },
    check (command) {
      if (command === 1) {
        this.dialogFormVisible = true
      }
    }
  },
  mounted () {

  }
}
</script>

<style lang="scss">
@import '../../assets/style/common.scss';
 .el-header {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
    border-bottom: 1px solid red;
    .personal-right {
      .el-dropdown-link {
        font-size: 16px;
        margin-right: 50px;
        cursor: pointer;
      }
    }
  }

  .el-aside {
    background-color: #545c64;
    color: #333;
    text-align: center;
    .el-menu-vertical-demo {
      margin-top: 30px;
    }
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
    height: 678px;
  }
</style>
